/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tblriesgosprofesionales")
@NamedQueries({
    @NamedQuery(name = "Tblriesgosprofesionales.findAll", query = "SELECT t FROM Tblriesgosprofesionales t"),
    @NamedQuery(name = "Tblriesgosprofesionales.findByIdRiesgo", query = "SELECT t FROM Tblriesgosprofesionales t WHERE t.idRiesgo = :idRiesgo"),
    @NamedQuery(name = "Tblriesgosprofesionales.findByDesRiesgo", query = "SELECT t FROM Tblriesgosprofesionales t WHERE t.desRiesgo = :desRiesgo")})
public class Tblriesgosprofesionales implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 4)
    @Column(name = "id_riesgo")
    private String idRiesgo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "des_riesgo")
    private String desRiesgo;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;

    public Tblriesgosprofesionales() {
    }

    public Tblriesgosprofesionales(String idRiesgo) {
        this.idRiesgo = idRiesgo;
    }

    public Tblriesgosprofesionales(String idRiesgo, String desRiesgo) {
        this.idRiesgo = idRiesgo;
        this.desRiesgo = desRiesgo;
    }

    public String getIdRiesgo() {
        return idRiesgo;
    }

    public void setIdRiesgo(String idRiesgo) {
        this.idRiesgo = idRiesgo;
    }

    public String getDesRiesgo() {
        return desRiesgo;
    }

    public void setDesRiesgo(String desRiesgo) {
        this.desRiesgo = desRiesgo;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRiesgo != null ? idRiesgo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tblriesgosprofesionales)) {
            return false;
        }
        Tblriesgosprofesionales other = (Tblriesgosprofesionales) object;
        if ((this.idRiesgo == null && other.idRiesgo != null) || (this.idRiesgo != null && !this.idRiesgo.equals(other.idRiesgo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + desRiesgo + "";
    }
    
}
